﻿<template>
  <div>
    <a-card :bordered="false" :bodyStyle="tstyle">

      <div class="table-page-search-wrapper" v-if="hasPerm('Nitf6201InputData:page')">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="8" :sm="24">
              <a-form-item label="医师编码 ">
                <a-input v-model="queryParam.atddrno" allow-clear placeholder="请输入医师编码 "/>
              </a-form-item>
            </a-col>
            <a-col :md="8" :sm="24">
              <a-form-item label="医师姓名 ">
                <a-input v-model="queryParam.drname" allow-clear placeholder="请输入医师姓名 "/>
              </a-form-item>
            </a-col><template v-if="advanced">
              <a-col :md="8" :sm="24">
                <a-form-item label="科室编码 ">
                  <a-input v-model="queryParam.deptcode" allow-clear placeholder="请输入科室编码 "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="科室名称 ">
                  <a-input v-model="queryParam.deptname" allow-clear placeholder="请输入科室名称 "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="科别 ">
                  <a-input v-model="queryParam.caty" allow-clear placeholder="请输入科别 "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="就诊ID ">
                  <a-input v-model="queryParam.mdtrtid" allow-clear placeholder="请输入就诊ID "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="医疗类别字典医疗类别(med_type) ">
                  <a-input v-model="queryParam.medtype" allow-clear placeholder="请输入医疗类别字典医疗类别(med_type) "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="病种编码按照标准编码填写：按病种结算病种目录代码(bydise_setl_list_code)、门诊慢特病病种目录代码(opsp_dise_cod)、 ">
                  <a-input v-model="queryParam.disecodg" allow-clear placeholder="请输入病种编码按照标准编码填写：按病种结算病种目录代码(bydise_setl_list_code)、门诊慢特病病种目录代码(opsp_dise_cod)、 "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="病种名称 ">
                  <a-input v-model="queryParam.disename" allow-clear placeholder="请输入病种名称 "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="个人结算方式 ">
                  <a-input v-model="queryParam.psnsetlway" allow-clear placeholder="请输入个人结算方式 "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="收费批次号 ">
                  <a-input v-model="queryParam.chrgbchno" allow-clear placeholder="请输入收费批次号 "/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="发票号 ">
                  <a-input v-model="queryParam.invono" allow-clear placeholder="请输入发票号 "/>
                </a-form-item>
              </a-col>            </template>

            <a-col :md="8" :sm="24" >
              <span class="table-page-search-submitButtons">
                <a-button type="primary" @click="$refs.table.refresh(true)" >查询</a-button>
                <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
                <a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '收起' : '展开' }}
                  <a-icon :type="advanced ? 'up' : 'down'"/>
                </a>
              </span>
            </a-col>

          </a-row>
        </a-form>
      </div>
    </a-card>
    <a-card :bordered="false">
      <s-table
        ref="table"
        :columns="columns"
        :data="loadData"
        :alert="true"
        :rowKey="(record) => record.iD"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
        <template class="table-operator" slot="operator" v-if="hasPerm('Nitf6201InputData:add')" >
          <a-button type="primary" v-if="hasPerm('Nitf6201InputData:add')" icon="plus" @click="$refs.addForm.add()">新增移动医保支付</a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a v-if="hasPerm('Nitf6201InputData:edit')" @click="$refs.editForm.edit(record)">编辑</a>
          <a-divider type="vertical" v-if="hasPerm('Nitf6201InputData:edit') & hasPerm('Nitf6201InputData:delete')"/>
          <a-popconfirm v-if="hasPerm('Nitf6201InputData:delete')" placement="topRight" title="确认删除？" @confirm="() => Nitf6201InputDataDelete(record)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </s-table>
      <add-form ref="addForm" @ok="handleOk" />
      <edit-form ref="editForm" @ok="handleOk" />
    </a-card>
  </div>
</template>
<script>
  import { STable } from '@/components'
  import { Nitf6201InputDataPage, Nitf6201InputDataDelete } from '@/api/modular/main/Nitf6201InputDataManage'
  import addForm from './addForm.vue'
  import editForm from './editForm.vue'
  export default {
    components: {
      STable,
      addForm,
      editForm
    },
    data () {
      return {
        advanced: false, // 高级搜索 展开/关闭
        queryParam: {},
        columns: [
          {
            title: '机构编码',
            align: 'center',
            dataIndex: 'orgcodg'
          },
          {
            title: '电子凭证机构',
            align: 'center',
            dataIndex: 'orgid'
          },
          {
            title: '人员编号 ',
            align: 'center',
            dataIndex: 'psnno'
          },
          {
            title: '险种类型',
            align: 'center',
            dataIndex: 'insutype'
          },
          {
            title: '医疗机构订单号',
            align: 'center',
            dataIndex: 'medorgord'
          },
          {
            title: '要续方的原处方流水rxCircFlag ',
            align: 'center',
            dataIndex: 'initrxord'
          },
          {
            title: '电子处方流转标志1：电子处方 ，0不是电子处方，默认0， ',
            align: 'center',
            dataIndex: 'rxcircflag'
          },
          {
            title: '开始时间挂号时间',
            align: 'center',
            dataIndex: 'begntime'
          },
          {
            title: '证件号码 ',
            align: 'center',
            dataIndex: 'idno'
          },
          {
            title: '用户姓名 ',
            align: 'center',
            dataIndex: 'username'
          },
          {
            title: '证件类别字典人员证件类型(psn_cert_type) ',
            align: 'center',
            dataIndex: 'idtype'
          },
          {
            title: '电子凭证授权 ecToken电子凭证解码返回 ',
            align: 'center',
            dataIndex: 'ectoken'
          },
          {
            title: '就诊参保地行政区划为空(null)时取用户电子凭证默认参保地 ',
            align: 'center',
            dataIndex: 'insucode'
          },
          {
            title: '住院/门诊号院内唯一流水 ',
            align: 'center',
            dataIndex: 'iptotpno'
          },
          {
            title: '医师编码 ',
            align: 'center',
            dataIndex: 'atddrno'
          },
          {
            title: '医师姓名 ',
            align: 'center',
            dataIndex: 'drname'
          },
          {
            title: '科室编码 ',
            align: 'center',
            dataIndex: 'deptcode'
          },
          {
            title: '科室名称 ',
            align: 'center',
            dataIndex: 'deptname'
          },
          {
            title: '科别 ',
            align: 'center',
            dataIndex: 'caty'
          },
          {
            title: '就诊ID ',
            align: 'center',
            dataIndex: 'mdtrtid'
          },
          {
            title: '医疗类别字典医疗类别(med_type) ',
            align: 'center',
            dataIndex: 'medtype'
          },
          {
            title: '费用类型字典费用类型（feeType） ',
            align: 'center',
            dataIndex: 'feetype'
          },
          {
            title: '医疗费总额 ',
            align: 'center',
            dataIndex: 'medfeesumamt'
          },
          {
            title: '个人账户使用标志药店上传费用时必填 ',
            align: 'center',
            dataIndex: 'acctusedflag'
          },
          {
            title: '主要病情描述 ',
            align: 'center',
            dataIndex: 'mainconddscr'
          },
          {
            title: '病种编码按照标准编码填写：按病种结算病种目录代码(bydise_setl_list_code)、门诊慢特病病种目录代码(opsp_dise_cod)、 ',
            align: 'center',
            dataIndex: 'disecodg'
          },
          {
            title: '病种名称 ',
            align: 'center',
            dataIndex: 'disename'
          },
          {
            title: '个人结算方式 ',
            align: 'center',
            dataIndex: 'psnsetlway'
          },
          {
            title: '收费批次号 ',
            align: 'center',
            dataIndex: 'chrgbchno'
          },
          {
            title: '公立医院改革标志可参考FSI的接口要求 ',
            align: 'center',
            dataIndex: 'pubhosprfomflag'
          },
          {
            title: '发票号 ',
            align: 'center',
            dataIndex: 'invono'
          },
          {
            title: '出院时间yyyy-MM-dd HH:mm:ss ',
            align: 'center',
            dataIndex: 'endtime'
          },
          {
            title: '全自费金额住院结算时需要 ',
            align: 'center',
            dataIndex: 'fulamtownpayamt'
          },
          {
            title: '超限价金额住院结算时需要 ',
            align: 'center',
            dataIndex: 'overlmtselfpay'
          },
          {
            title: '先行自付金额住院结算时需要 ',
            align: 'center',
            dataIndex: 'preselfpayamt'
          },
          {
            title: '符合政策范围金额住院结算时需要 ',
            align: 'center',
            dataIndex: 'inscpscpamt'
          },
          {
            title: '手术操作代码住院结算时需要 ',
            align: 'center',
            dataIndex: 'oprnoprtcode'
          },
          {
            title: '手术操作名称住院结算时需要 ',
            align: 'center',
            dataIndex: 'oprnoprtname'
          },
          {
            title: '计划生育服务证号住院结算时需要 ',
            align: 'center',
            dataIndex: 'fpscno'
          },
          {
            title: '晚育标志住院结算时需要 ',
            align: 'center',
            dataIndex: 'latechbflag'
          },
          {
            title: '孕周数住院结算时需要 ',
            align: 'center',
            dataIndex: 'gesoval'
          },
          {
            title: '胎次住院结算时需要 ',
            align: 'center',
            dataIndex: 'fetts'
          },
          {
            title: '胎儿数住院结算时需要 ',
            align: 'center',
            dataIndex: 'fetuscnt'
          },
          {
            title: '早产标志住院结算时需要 ',
            align: 'center',
            dataIndex: 'pretflag'
          },
          {
            title: '计划生育手术类别生育门诊按需录入 ',
            align: 'center',
            dataIndex: 'birctrltype'
          },
          {
            title: '计划生育手术或生育日期生育门诊按需录入，yyyy-MM-dd ',
            align: 'center',
            dataIndex: 'birctrlmatndate'
          },
          {
            title: '伴有并发症标志住院结算时需要 ',
            align: 'center',
            dataIndex: 'copflag'
          },
          {
            title: '出院科室编码住院结算时需要 ',
            align: 'center',
            dataIndex: 'dscgdeptcodg'
          },
          {
            title: '出院科室名称住院结算时需要 ',
            align: 'center',
            dataIndex: 'dscgdeptname'
          },
          {
            title: '出院床位住院结算时需要 ',
            align: 'center',
            dataIndex: 'dscgded'
          },
          {
            title: '离院方式住院结算时需要 ',
            align: 'center',
            dataIndex: 'dscgway'
          },
          {
            title: '死亡日期yyyy-MM-dd ',
            align: 'center',
            dataIndex: 'diedate'
          },
          {
            title: '生育类别住院结算时需要 ',
            align: 'center',
            dataIndex: 'matntype'
          },
          {
            title: '扩展参数可参考FSI的接口要求 ',
            align: 'center',
            dataIndex: 'expcontent'
          },
          {
            title: '中途结算标志字典中途结算标志（mid_setl_flag） ',
            align: 'center',
            dataIndex: 'midsetlflag'
          },
          {
            title: '入院诊断描述住院结算时需要 ',
            align: 'center',
            dataIndex: 'admdiagdscr'
          },
          {
            title: '入院科室编码住院结算时需要 ',
            align: 'center',
            dataIndex: 'admdeptcodg'
          },
          {
            title: '入院科室名称住院结算时需要 ',
            align: 'center',
            dataIndex: 'admdeptname'
          },
          {
            title: '入院床位住院结算时需要 ',
            align: 'center',
            dataIndex: 'admbed'
          },
          {
            title: '支付授权码线上授权返回 ',
            align: 'center',
            dataIndex: 'payauthno'
          },
          {
            title: '经纬度格式:经度,纬度如 ：118.096435,24.485407定位失败情况下传：0,0 ',
            align: 'center',
            dataIndex: 'uldlatlnt'
          },
          {
            title: '就诊凭证类型“00” 无就诊介质，“01” 电子凭证，“02”居民身份证，“03”社会保障卡 ',
            align: 'center',
            dataIndex: 'mdtrtcerttype'
          },
          {
            title: '用户参保地行政区划无值(null)时取用户电子凭证设置的默认参保地 ',
            align: 'center',
            dataIndex: 'insuplcadmdvs'
          },
          {
            title: '创建时间',
            align: 'center',
            dataIndex: 'creatceDate'
          },
          {
            title: '创建者Id',
            align: 'center',
            dataIndex: 'createUserId'
          },
          {
            title: '创建者名称',
            align: 'center',
            dataIndex: 'createUserName'
          },
          {
            title: '更新时间',
            align: 'center',
            dataIndex: 'modifyDate'
          },
          {
            title: '修改者Id',
            align: 'center',
            dataIndex: 'modifyUserId'
          },
          {
            title: '修改者名称',
            align: 'center',
            dataIndex: 'modifyUserName'
          },
          {
            title: '删除时间',
            align: 'center',
            dataIndex: 'deleteDate'
          },
          {
            title: '删除者ID',
            align: 'center',
            dataIndex: 'deleteUserId'
          },
          {
            title: '删除者姓名',
            align: 'center',
            dataIndex: 'deleteUserName'
          }
        ],
        tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
        // 加载数据方法 必须为 Promise 对象
        loadData: parameter => {
          return Nitf6201InputDataPage(Object.assign(parameter, this.queryParam)).then((res) => {
            return res.data
          })
        },
        selectedRowKeys: [],
        selectedRows: []
      }
    },
    created () {
      if (this.hasPerm('Nitf6201InputData:edit') || this.hasPerm('Nitf6201InputData:delete')) {
        this.columns.push({
          title: '操作',
          width: '150px',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        })
      }
    },
    methods: {
      /**
       * 查询参数组装
       */
      switchingDate () {
        const obj = JSON.parse(JSON.stringify(this.queryParam))
        return obj
      },
      Nitf6201InputDataDelete (record) {
        Nitf6201InputDataDelete(record).then((res) => {
          if (res.success) {
            this.$message.success('删除成功')
            this.$refs.table.refresh()
          } else {
            this.$message.error('删除失败') // + res.message
          }
        })
      },
      toggleAdvanced () {
        this.advanced = !this.advanced
      },
      handleOk () {
        this.$refs.table.refresh()
      },
      onSelectChange (selectedRowKeys, selectedRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectedRows = selectedRows
      }
    }
  }
</script>
<style lang="less">
  .table-operator {
    margin-bottom: 18px;
  }
  button {
    margin-right: 8px;
  }
</style>
